<!DOCTYPE html>
<html>
    <head>
        <title>IE XPath Example</title>       
        <script type="text/javascript">
        function createDocument(){
            if (typeof arguments.callee.activeXString != "string"){
                var versions = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0",
                                "MSXML2.DOMDocument"];
        
                for (var i=0,len=versions.length; i < len; i++){
                    try {
                        var xmldom = new ActiveXObject(versions[i]);
                        arguments.callee.activeXString = versions[i];
                        return xmldom;
                    } catch (ex){
                        //skip
                    }
                }
            }
        
            return new ActiveXObject(arguments.callee.activeXString);
        }              
        </script> 
    </head>
    <body>
        <p>This example uses namespaces.</p>
        <script type="text/javascript">
        
            var xmldom = createDocument();
            xmldom.loadXML("<?xml version=\"1.0\"?><wrox:books xmlns:wrox=\"http://www.wrox.com/\"><wrox:book><wrox:title>Professional JavaScript for Web Developers</wrox:title><wrox:author>Nicholas C. Zakas</wrox:author></wrox:book><wrox:book><wrox:title>Professional Ajax</wrox:title><wrox:author>Nicholas C. Zakas</wrox:author><wrox:author>Jeremy McPeak</wrox:author><wrox:author>Joe Fawcett</wrox:author></wrox:book></wrox:books>");
            //xmldom.setProperty("SelectionNamespaces", "xmlns:wrox='http://www.wrox.com/'");

            var result = xmldom.documentElement.selectNodes("wrox:book/wrox:author");            
            alert(result.length);            
        </script>
 
 
    </body>
</html>
